1. Field of the Invention
The present invention relates to a technique supporting development of a servo control part (servo control program) of a control program for a product of a relatively small size and having rapid response. Particularly, the present invention relates to a control program development support apparatus suitable for use when a servo control program (firmware) for every product requiring a precise servo control such as amagnetic disk drive (HDD), an optical diskdrive (CD, MO, DVD, MD), amagnetic tape unit (DAT, VTR), an NC machine tool, etc.
2. Description of the Related Art
When a mechanism having an actuator (motor) and a sensor, and operating three-dimensionally is designed, a plan of the mechanism is first worked out. Then, detailed design, drawing issue and parts preparation are done, the parts are assembled to built a prototype, then operations and the like of the prototype are evaluated, in general. After that, a process of changing the design according to a result of the evaluation, manufacturing a prototype whose design has been changed, and again making evaluation is repeated. When a result of the evaluation is satisfactory, the design is completed.
In order to operate the mechanism designed as above, a control program for controlling the mechanism is generally developed. The control program is executed by a microcomputer built in the mechanism that is a controlled object. Hereinafter, the above control program executed by the microcomputer is occasionally referred to as a built-in software.
When the above control program (built-in software) is developed, it is heretofore necessary that a trial product (prototype) of the mechanism to be controlled is completed. Namely, the mechanism can be operated only after the trial product is completed, and development of the built-in software using the trial product can be initiated.
Development of the built-in software is done in the following manner while the trial product is actually operated after the trial product is completed. First, rough design of the built-in software is made, detailed design is made on the basis of the rough design, a built-in software is created by coding a result of the detailed design, and the built-in software is debugged.
Meanwhile, construction and validation of the servo mechanism of the firmware is heretofore done by using an actual mechanism (prototype), like development of a built-in software described above.
When construction and validation of the servo mechanism of the firmware is done in the above manner, inspection can be done only after a prototype is completed, a cost and a time are therefore required for the development, which is inefficient. In addition, inspection using a prototype causes such a disadvantage that even when a firmware program is stopped due to an event break or the like, a motor configuring the servo mechanism keeps rotating so that step debugging is impossible.
Further, a servo mechanism control program for a product produced on the order of tens of thousands per month has to be able to cope with variations in mechanism to a certain degree. In development using an actual mechanism, it is difficult to obtain a mechanism in a desired state considering the above variations, and it is also difficult to know how much the firmware can cope with variations.
For this reason, it is desired to effectively develop (construct, validate) a firmware without using a prototype by making a virtual model on a computer and controlling the model by an actual firmware. If such a technique is realized, anticipatory development becomes possible, use of a step debugging function or the like becomes possible since an actual motor is not used, a novel control technique using a new actuator or sensor can be simply validated without making a prototype.
There has been a system for controlling a model in a simulator instead of an actual product by a control program operating on another computer such as HIL (Hardware In the Loop) simulation system by dSPACE, Inc., for example. Since this system simulates in real time, objects of the simulation are products having slow response (for example, products that can be simulated at not less than 1 msec simulation time intervals) such as automobiles, ships and the like. Therefore, it is difficult for this system to simulate a product of a relatively small size and having rapid response (for example, a product that should be simulated at each interval of about 100 xcexcsec) such as a magnetic disk drive (HDD) or the like.
Inventors of the present invention have proposed a support system by which a built-in software (control program) can developed separately from mechanism design without producing a trial product of the mechanism, putting a three-dimensional real-time simulation apparatus in the center. Validation of the control program by this support system is done on the task level. In this support system, an operation of the actuator in response to a command from the control program""s side is simulated, and the control program is validated on the basis of an ON/OFF signal of the sensor according to the operation. Therefore, this support system cannot validate (develop, debug) of the control program on the servo level analyzing dynamics of the model.
The servo mechanism is an automatic feed-back control system for mechanical motions, which is used to control a system in which a controlled variable or a control output is a mechanical position [or one of inductive variables (such as velocity, acceleration and the like). To validate a control program for the servo control part, it is necessary to simulate the servo mechanism not on the task level but while dynamically analyzing a controlled variable such as the above mechanical position or the like (that is, on the servo level). When validation is made on the servo level, it is necessary to strictly simulate by dynamic analysis, which leads to difficulty in simulation in real time.
For this, it is desired to be able to develop and debug (validate) the servo control part (hereinafter referred to a servo control program, occasionally) of the control program for a product of a relatively small size and having rapid response without using an actual mechanism.
Meanwhile, there has been a general technique of modeling a controlled object and a control law for the controlled object, and validating the control law. This technique enables validation of the control law on the theoretical level, but cannot cope with various problems (execution speed, code size, consumed memory quantity, mixing of bugs and the like) occurring when the validated control law is coded into actual firmware (control program). Additionally, since this technique is for validation of a control law, this technique cannot validate a control program created on the basis of the control program. When the control program is validated, the above general technique is used after all.
In the light of the above problems, an object of the present invention is to provide a control program development support apparatus enabling development and debugging (validation) of a control program for controlling a relatively small product (mechanism) having rapid response without using an actual mechanism.
The present invention therefore provides a control program development support apparatus, in which a predetermined simulation cycle in a simulation unit is set shorter than a predetermined control cycle in a control program executing unit, the simulation unit simulates an operation of a mechanism in the predetermined simulation cycle for a time corresponding to the predetermined control cycle, and outputs a state variable of the mechanism to a holding unit, a simulation control unit makes the simulation unit shift to a state of waiting for a response from the control program execution unit and makes the control program execution unit initiate an operation of calculating a controlled variable according to the state variable when the state variable from the simulation unit is held in the holding unit, whereas making the control program execution unit shift to a state of waiting for a response from the simulation unit and making the simulation unit initiate a simulating operation according to the controlled variable when the controlled variable from the control program execution unit is held in the holding unit.
In the above control program development support apparatus according this invention, a mechanism (servo mechanism), that is a controlled object plant, is modeled, and the simulation unit for simulating an operation of the model and the control program execution unit for executing firmware controlling the operation of the mechanism (servo mechanism) are connected via the holding unit. The simulation control unit can synchronize an operation of the simulation unit with an operation of the control program execution unit, whereby precise simulation becomes possible while keeping time strictness. At that time, the simulation unit simulates in a simulation cycle shorter than a control cycle (servo cycle in servo control firmware) in the control program execution unit, thus execution of precise simulation becomes possible.
The control program development support apparatus may further comprise a synchronous setting means for performing synchronous setting of the simulation control unit. The synchronous setting means may be configured using a graphical user interface function. Whereby, synchronous setting between an operation of the simulation unit an operation of the control program execution unit may be performed. Further, the synchronous setting may be readily performed using graphic.
The control program execution unit may output a plurality of controlled variables to be inputted to the simulation unit at different timings during one control cycle, and the control program development support apparatus may further comprise a multi-rate control means for performing an input control on the plural controlled variables such that the controlled variables are inputted to the simulation unit at respective predetermined timings. At this time, the control program development support apparatus may still further comprise a multi-rate setting means for performing setting of the multi-rate control means, and the multi-rate setting means may be configured using a graphical user interface function.
The simulation unit can simulate the multi-rate control in which a controlled variable is changed during one control cycle by using the multi-rate control means. By means of the multi-rate setting means, it is possible to define and set the multi-rate control, and to readily set the multi-rate control by using graphic.
The simulation control unit may determine a timing, at which the control program execution unit starts calculating the controlled variable, on the basis of a result of simulation by the simulation unit. According to a result of simulation by the simulation unit, the process can shift to a servo control routine in the control program execution unit, so that it becomes possible to confirm a fail-safe function by a timer, or cope with a process of measuring a changed variable (velocity, rotation number, etc.) per unit time.
The model may be configured with a plurality of parts of which operations can be separately simulated, and the simulation unit may comprise a plurality of processors for simulating in parallel the operations of the plural parts. It is there by possible to execute simulation of parts of the model in parallel by the plural processors.
The holding unit may comprise a plurality of registers for temporarily holding data including the controlled variable to be transferred from the control program execution unit to the simulation unit and the state variable to be transferred from the simulation unit to the control program execution unit, a first write/read control unit for controlling writing/reading of the data between the plural registers and the control program execution unit, and a second write/read control unit for controlling writing/reading of the data between the plural registers and the simulation unit.
The controlled variable from the control program execution unit is temporarily written in an appropriate register by the first write/read control unit, after that, read out by the second write/read control unit and inputted to the simulation unit according to a synchronous signal. On the other hand, the state variable from the simulation unit is temporarily written in an appropriate register by the second write/read control unit, after that, read out by the first write/read control unit and inputted to the control program execution unit according to a synchronous signal (interrupt signal).
At this time, an interrupt signal, which is inputted to one of the plural registers from the simulation unit in order to make the control program execution unit initiate the operation of calculating the controlled variable, may be directly sent from the register to the control program execution unit without reference to the first write/read control unit. The control program execution unit""s side can obtain the interrupt signal without performing a read control (reading operation by firmware) by the first write/read control unit, thus can perform synchronous processing using hardware interrupt.
The control program development support apparatus may still further comprise a data display unit for displaying data held in the plural registers. At this time, the control program development support apparatus may still further comprise a selecting unit for selecting at least one register selected from the plural registers to make the data display unit display data held in the selected register. Alternatively, the data display unit may be directly connected to a specific register among the plural registers to display data held in the specific register. Whereby, data being now communicated between the control program execution unit and the simulation unit can be displayed on the data display unit, the operator, for example, can refer and confirm the data.
The control program development support apparatus may still further comprise a data input unit for forcedly setting and storing desired data in at least one of the plural registers. At this time, the data input unit may be directly connected to the specific register among the plural registers to set the desired data in the specific register from the data input unit. The operator, for example, writes arbitrary data from the data input unit into the register to directly input the data in the control program execution unit or the simulation unit. Accordingly, the operator can confirm behavior of the control program or an operating state of the model according to the data.
The control program development support apparatus may still further comprise a noise superposing unit for superposing noise on data read out from at least one of the plural registers. The operator, for example, can superpose noise on data by the noise superposing unit to confirm behavior of the control program or an operation state of the model.
The control program development support apparatus according to this invention provides the following effects and advantages:
(1) By delaying the operating process in the control program execution unit to synchronize it with the model operating process (simulation) in the simulation unit, it becomes possible to simulate precisely as in slow motion while keeping time strictness without changing the characteristic (servo characteristic) of the mechanism. It is therefore possible to develop and debug (validate) the control program for a relatively small product having rapid response without using an actual mechanism.
(2) It is possible to readily create a model having an arbitrary characteristic and control by the control program only by changing parameters. It is therefore possible to validate how much the control program can cope with variations in product manufactured in large volume, that is, to certainly validate a quality of the control program.
(3) Simulation using a virtual model enables use of functions such as step debugging and the like, and easy development of the control product. It is also possible to simply validate a new control method using a new actuator or sensor.
(4) The operator, for example, can readily and arbitrarily perform the synchronous setting between the operation of the simulation unit and the operation of the control program execution unit by using the synchronous setting means (GUI function).
(5) Since the multi-rate control, in which a controlled variable is changed during one control cycle, is simulated by using the multi-rate control means, it is possible to certainly cope with a case where the servo logic realizes the multi-rate control. At this time, the operator, for example, can readily and arbitrarily define and set the multi-rate control using the multi-rate setting means (GUI function).
(6) The process can be shifted to the control routine in the control program execution unit according to a result of simulation by the simulation unit. Accordingly, various functions such as confirming the fail-safe function by a timer, coping with a process of measuring a changed variable (velocity, rotation number, etc.) per unit time and the like are realized so that development and debugging (validation) of the control program can be certainly supported.
(7) Since simulation of operations of the structure of a model can be carried out in parallel by plural processors, the simulating process can be largely sped up.
(8) Since the holding unit is configured with the plural registers, the first write/read control unit and the second write/read control unit, a controlled variable from the control program execution unit and a state variable from the simulation unit can be temporarily held in the registers, and certainly transferred to the simulation unit and the control program executing unit, respectively.
(9) Since the control program execution unit""s side can obtain an interrupt signal without performing the read control by the first write/read control unit, the synchronous processing using hardware interrupt becomes possible. The control program execution unit can thereby immediately and certainly initiate an operation of calculating a controlled variable, according to the interrupt signal.
(10) The operator, for example, can refer and confirm data owing to the data display unit displaying the data being now communicated between the control program execution unit and the simulation unit. It is thereby possible to certainly support development and debugging (validation) of the control program.
(11) The operator, for example, can write arbitrary data from the data input unit into the register to directly input the data to the control program execution unit or the simulation unit. The operator can thereby confirm behavior of the control program or an operating state of the model according to the data, thus development and debugging (validation) of the control program is certainly supported.
(12) The operator, for example, can superpose noise on data by the noise superposing unit. The operator can thereby confirm behavior of the control program or an operating state of the model according to the noise, thus development and debugging (validation) of the control program is certainly supported.